/********************************************************/
/*	Copyright (C) 2016 Gong Li Bin		 	*/
/*	Project:	GlbRtbEng-1.0.0			*/
/*	Author:		gong_libin			*/
/*	Date:		2016_06_26			*/
/*	File:		GlbRtbAreaTest.cpp		*/
/********************************************************/

#include "GlbRtbArea.h"

int main(int argc, char* argv[])
{
	CGlbRtbArea CArea;
	char szArea[GLB_BYTE16] = { 0 };
	char szAddr[GLB_BYTE16] = "124.202.219.66";
	char szXml[] = "/root/GlbRtbConf-1.0.0/GlbRtbArea.xml";

	if (argc > 1) {
		strcpy(szAddr, argv[1]);
	}

	if (GLB_SUCCESS == CArea.GlbRtbBaseCreate(ftok(GLB_RR_PATH, GLB_RR_KEY), GLB_RR_SUM, GLB_RR_SIZE, NULL)) {
		CArea.GlbRtbBaseReset(GLB_RR_SUM);
		CArea.GlbRtbBaseInput((void*)szXml);
		CArea.GlbRtbAreaGet(szAddr, szArea);
		if (strlen(szArea) > 0) {
			GLB_PRINT("Addr: %s -> Area: %s\n", szAddr, szArea);
		}
		else {
			GLB_PRINT("Addr: %s -> Area: NULL\n", szAddr);
		}

		CArea.GlbRtbBaseDelete();
	}
	else {
		GLB_ERROR("Faild to GlbRtbAreaCreate\n");
	}

	return GLB_SUCCESS;
}
